import sdljava.SDLException;
import sdljava.video.SDLRect;
import sdljava.video.SDLSurface;
import java.util.List;

public class SpriteImage extends Image{
	
	public SpriteImage(GameWindow gameWindow) {
		super(gameWindow);
	}
	public void show(SDLSurface image, int x, int y, SDLRect clip) throws SDLException{
		SDLRect offset = new SDLRect();
		
		offset.setX(x);
		offset.setY(y);
		
		image.blitSurface(clip, gameWindow.getGameSurface(), offset);
		gameWindow.getGameSurface().flip();
	}
	public void clip(ImageData dim, int x, int y){
		int cornerx = x;
		int cornery = y;
		int amount = dim.amount;
		int orientation = dim.orientation;
		SDLRect button;
		for(int i=0; i<amount; i++){
			button = new SDLRect();
			if(orientation == 1){ // 1 = horizontal
				button.x = cornerx;
				button.y = cornery;
				button.width = dim.width;
				button.height = dim.height;
				images.add(button);
				cornerx += dim.width;
			}
			else if(orientation == 0){ // 0 = vertical
				button.x = cornerx;
				button.y = cornery;
				button.width = dim.width;
				button.height = dim.height;
				images.add(button);
				cornery += dim.height;
			}
		}
	}
	
}
